package tony.test.mybatis.datascope.config

import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils
import org.mybatis.spring.annotation.MapperScan
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import tony.mybatis.interceptor.PaginationInnerInterceptor
import tony.test.mybatis.datascope.TestPaginationInterceptor

/**
 * 测试配置类，用于覆盖分页拦截器
 */
@MapperScan("tony.test.mybatis.datascope.mapper")
@Configuration
class DataScopeTestConfiguration {
    @Bean
    fun paginationInnerInterceptor(
        dataSourceProperties: DataSourceProperties,
    ): PaginationInnerInterceptor {
        return TestPaginationInterceptor(JdbcUtils.getDbType(dataSourceProperties.url))
    }
}
